home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 001-025 / scopedisk2 / conman / push.doc < prev    next >
Text File  |  1995-03-18  |  3KB  |  57 lines

  1. ========================================================================
  2.  
  3.                            PUSH, QUEUE, and DROPBUF
  4.  
  5. ========================================================================
  6.  
  7. ConMan provides special capabilities (in versions 1.0 and later) that 
  8. allow an input stream to be used as a temporary "scratchpad" to store a 
  9. series of data lines.  These lines can be "stacked" (last in, first out) 
  10. or "queued" (first in, first out) to be read at a later time.  These
  11. special capabilities are available through the CLI command utilities
  12. PUSH, QUEUE, and DROPBUF.  Here's what they do:
  13.  
  14. PUSH takes its command line and "stacks" it in the input stream.  Stacked
  15. lines always go the the head of the internal buffer, and are then available 
  16. for the next program (or the CLI) that reads from the stream.  For example,
  17. entering "push echo hi" would result in 
  18.  
  19. 1> push echo hi
  20. 1> hi
  21. 1>
  22.  
  23. The command line can be surrounded by double-quotes to prevent the CLI
  24. from breaking it; the quotes are stripped off before the line is actually
  25. stacked.  PUSH is useful within an "execute" script to allow a series of
  26. responses to be prepared for a program.  For exam[le, suppose that the 
  27. program "myprog" expects three lines of input.  Then the following script
  28. could be used to launch the program:
  29.  
  30. ; Launch "myprog" with prepared data
  31. push data line 3
  32. push data line 2
  33. push data line 1
  34. df1:c/myprog -t
  35.  
  36. Note that the command lines are stacked in reverse order (well, in normal
  37. order if you're a Forth programmer.)
  38.  
  39. The QUEUE command behaves just like the PUSH command, except that it 
  40. places the data in "first in, first out" order.  New data is placed behind
  41. all previously queued (or stacked) data.  The choice of whether to use 
  42. PUSH or QUEUE is usually just a matter of convenience, unless the data is
  43. available in a particular order that constrains the decision.
  44.  
  45. Data lines entered by PUSH or QUEUE are never displayed on the console,
  46. and are always ahead of any data received through the input stream.
  47.  
  48. Sometimes it may be necessary to delete or purge previously stacked data.
  49. For example, if a program aborted after reading only part of its prepared
  50. input stream, it would be confusing (or dangerous!) for the stacked data
  51. to be read from the command stream.  The DROPBUF command is provided to 
  52. "drop" (delete) all stacked or queued data, without perturbing any of the
  53. lines received through the input stream.  
  54.  
  55. Two brief demonstration scripts, "pushdemo" and "dropdemo", have been
  56. included as examples.  Type them out and then try "execute pushdemo".
  57.